#include<iostream>
#include<cstring>
using namespace std;
int n,m,s_x,s_y,d_x,d_y,m_x[]={1,1,2,2},m_y[]={-2,2,-1,1};;
long long xy[60][60]={0};

int main()
{
    scanf("%d%d",&n,&m);
    scanf("%d%d%d%d",&s_x,&s_y,&d_x,&d_y);
    xy[s_x][s_y]=1;
    for (int i = s_x; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
          for (int k = 0; k < 4; k++)
          {
              if(i+m_x[k]>0&&i+m_x[k]<=n&&j+m_y[k]>0&&j+m_y[k]<=m);
              xy[i+m_x[k]][j+m_y[k]] += xy[i][j];
          }
        }
    }
    printf("%lld",xy[d_x][d_y]);
    return 0;
}
